extends "../kelifulan-3/kelifulan-3.gd"


var baseId = ""
var upText1 = "强袭号令额外作用于2个目标"
var upText2 = "水面侦听作用于全体友军"
func _extInit():
	._extInit()
	lv = 4             #等级的设置
	addSkill("<唯一>战斗开始时，使周围2格的友军获得<强化水侦>", "水面侦听", "forceCooldown", 8)

func _onBattleStart():
	._onBattleStart()
	if upgraded == 2:
		for cha in getAllChas(2):
			castBuff(cha, b_hszf.new(0.3))
	else:
		for cha in getCellChas(cell, 2, 2):
			castBuff(cha, b_hszf.new(0.3))

class b_hszf:
	extends "../../../azurlane_ctrl/AzurBuff.gd"
	var p = 0.25
	func _init(p = 0.25):
		attInit()
		id = "b_hszf"
		self.p = p
		buffName = "强化水侦"
		dispel = 2
	func _connect():
		masCha.connect("onHurt",self,"_onHurt")
	func _onHurt(atkInfo):
		if atkInfo.atkType == sys.AtkType.SKILL and atkInfo.atkCha != masCha:
			var num = atkInfo.hurtVal*p
			if masCha.team == 2:
				num = min(atkInfo.atkCha.att.maxHp, num)
				num *= 0.5
			casCha.azurHurtChara(atkInfo.atkCha, num, atkInfo.hurtType, sys.AtkType.EFF, "水面侦听")
			atkInfo.hurtVal *= (1-p)
			for j in atkInfo.atkCha.skills:
				j.nowTime -= 1